//
//  MyButtonCell.m
//  AnimationRecommend
//
//  Created by ljm on 2017/2/18.
//  Copyright © 2017年 ljm. All rights reserved.
//

#import "MyButtonCell.h"

#import "CharacterWithIconBtn.h"

@interface MyButtonCell()

@property(nonatomic,strong)CharacterWithIconBtn *likeBtn;//点赞
//@property(nonatomic,strong)CharacterWithIconBtn *announceBtn;//发布
@property(nonatomic,strong)CharacterWithIconBtn *evaluateBtn;//评价

@end

@implementation MyButtonCell

//- (void)setModel:(HomeModel *)model {
//    _model = model;
//    
//    [_likeBtn setTitle:model.likeBtn forState:normal];
//    [_evaluateBtn setTitle:model.judgeBtn forState:normal];
//}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createCell];
    }
    return self;
}

+(instancetype)loadCellWithTableView:(UITableView *)tableView {
    
    static NSString *cellIdentifier = @"MybuttonCell";
    
    MyButtonCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    
    if (!cell) {
        cell = [[MyButtonCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)createCell {

    __weak typeof(self)weakSelf = self;
    
    _likeBtn = [[CharacterWithIconBtn alloc]initWithFrame:AAdaptionRect(20, 10, 150, 60) withTag:101 withTitle:@"点赞" withTitleColor:[UIColor blackColor] withImage:@"heart-2" withFont:25 withDirection:left withBlock:^(id sender) {
        
        if (weakSelf.delegate) {
            [weakSelf.delegate cellBtnClick:(UIButton *)sender];
        }
        
    }];
    
    //        _announceBtn = [[CharacterWithIconBtn alloc]initWithFrame:AAdaptionRect(kBaseWidth - 260 - 30, 10, 120, 60) withTag:102 withTitle:@"发布" withTitleColor:[UIColor blackColor] withImage:@"分享" withFont:25 withDirection:right withBlock:^(id sender) {
    //
    //        }];
    
    _evaluateBtn = [[CharacterWithIconBtn alloc]initWithFrame:AAdaptionRect(kBaseWidth - 150 - 20, 10, 120, 60) withTag:103 withTitle:@"评价" withTitleColor:[UIColor blackColor] withImage:@"chat-2" withFont:25 withDirection:right withBlock:^(id sender) {
        if (weakSelf.delegate) {
            [weakSelf.delegate cellBtnClick:(UIButton *)sender];
            
        }
    }];
    
    [self.contentView addSubview:_likeBtn];
    //        [self addSubview:_announceBtn];
    [self.contentView addSubview:_evaluateBtn];
}

@end
